package shejimoshi.guanchazhemoshi;

public class client {
    public static void main(String[] args) {
        ConcreteSubject subject = new ConcreteSubject();

        ConcreteObserver observer1 = new ConcreteObserver("Observer 1");
        ConcreteObserver observer2 = new ConcreteObserver("Observer 2");

        subject.registerObserver(observer1);
        subject.registerObserver(observer2);

        subject.setState("New State"); // 触发通知

        subject.removeObserver(observer1);
        subject.setState("Another State"); // 触发通知，observer1 不会收到
    }
}
